#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

const ll N = 1e6 + 10, INF = 0x3f3f3f3f;

ll x, y, A, B;

void solve()
{
    cin >> x >> y >> A >> B;
    if (x == y) {
        cout << "YES\n" << 2 << " " << 2 << '\n';
        return;
    }
    ll sx = sqrt(x), sy = sqrt(y);
    map<ll, pair<ll, ll>> hs;
    for (ll l = 2, r;l <= B && l <= y;l = r + 1) {
        r = y / (y / l);
        hs[y / l] = { l,min(r,B) };
    }
    for (ll l = 2, r;l <= A && l <= x;l++) {
        ll t = x / l;r = x / t;
        if (hs.find(t) == hs.end() || (x - y) % t) continue;
        ll l1 = hs[t].first, r1 = hs[t].second, l2 = l, r2 = min(r, A);
        ll d = (x - y) / t;
        if (l2 - r1 <= d && d <= r2 - l1) {
            ll b = l1;
            ll a = b + d;
            if (a < l2) {
                ll p = l2 - a;
                b += p;a += p;
            }
            if (a > sx && b > sy) {
                cout << "YES\n" << a << " " << b << '\n';
                return;
    }
        }
}

    map<vector<ll>, ll> mp;
    for (ll i = 2;i <= A && i <= sx;i++) {
        vector<ll> s;
        ll t = x;
        while (t) {
            s.push_back(t % i);
            t /= i;
        }
        reverse(s.begin(), s.end());
        mp[s] = i;
    }
    for (ll i = 2;i <= B && i <= sy;i++) {
        vector<ll> s;
        ll t = y;
        while (t) {
            s.push_back(t % i);
            t /= i;
        }
        reverse(s.begin(), s.end());
        if (mp.find(s) != mp.end()) {
            cout << "YES\n" << mp[s] << " " << i << '\n';
        return;
    }
    }
    cout << "NO\n";
}

signed main()
{
    //ios::sync_with_stdio(0);
    //cin.tie(0);cout.tie(0);
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif
    ll T = 1;
    cin >> T;
    for (ll i = 1;i <= T;i++) {
        solve();
    }
}